package cn.wsalix.admin.service;

import java.util.List;
import java.util.Observer;

import cn.anlaser.service.RelatedService;
import cn.wsalix.admin.entity.SysRole;
import cn.wsalix.admin.entity.SysUser;
import cn.wsalix.admin.entity.UserRole;
import cn.wsalix.admin.form.UserRoleForm;
import cn.wsalix.admin.repository.UserRoleRepository;

public interface UserRoleService
		extends
		RelatedService<UserRoleForm, UserRoleRepository, UserRole, SysUser, SysRole>,
		Observer {

	/**
	 * @param userId
	 * @param role
	 */
	void insertRole(Long userId, SysRole role);

	/**
	 * @param userId
	 * @param role
	 */
	void delCurrRole(Long userId, SysRole role);

	/**
	 * @param roleId
	 *            更新角色对应的用户权限
	 */
	public void upUserRole(Long roleId);

	List<SysRole> findUnRolesByMenuId(Long menuId);

	/**
	 * @param userId
	 * @return
	 */
	List<SysRole> findRolesByUserId(Long userId);

	/**
	 * @param username
	 * @return
	 */
	List<SysRole> findRolesByUsername(String username);

	List<SysRole> findAllRoles();

}
